#pragma once

#include "SurfaceMeshHelper.h"
using namespace SurfaceMesh;

#include "macro.h"

struct Sample{
	Vec3d	p, n;
	int		id;
	bool	isVertex;

	Sample(Vec3d p, Vec3d n, int id, bool isVertex)
	{
		this->p = p;
		this->n = n;
		this->id = id;
		this->isVertex = isVertex;
	}

	Face face()
	{
		return Face(id);
	}

	Vertex vertex()
	{
		return Vertex(id);
	}
};

class Sampler : public SurfaceMeshHelper
{
public:
    Sampler(SurfaceMeshModel *mesh);
	
	std::vector<Sample> getSamples(int numSamples);

	// Original vertices
	std::vector<Sample> getVerticesAsSamples();

	// Random barycentric samples
	std::vector<double> accumProbability;
	Sample BarycentricOnFace( Face f, double U, double V );
	std::vector<Sample> getRandomBarycentricSamples( int numSamples);
};
